<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    .navbar {
      height: 80px;
      background: pink;
    }
  </style>
  <title>组合和继承</title>
</head>
<body>
  <div id="app"></div>
  <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
  <!-- 使用jsx需要babel转义 -->
  <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
  <!-- 使用babel需要申明type -->
  <script type="text/babel">
    const tag = document.getElementById('app')
    function Logo(props) {
      return (
        <div>{props.title}</div>
      )
    }
    function NavBar() {
      return (<div className="navbar">
      <Logo title='React'/>
      navbar
      </div>)
    }
    function Title(props) {
      return (
        <div>{props.title}{props.children}</div>
      )
    }
    function PageBody() {
      return (
        <div>
          PageBody
          <Title title="组合和继承">
          <h1>hhhh</h1>
          </Title>
        </div>
      )
    }
    function Page() {
      return (
        <div>
        <NavBar />
        <PageBody />
        </div>)
    }
    ReactDOM.render(
      <Page />,
      tag
    )
  </script>
</body>
</html>